using System;
using UnityEngine.TestTools;

/// <summary>
/// 定义与后端有关的Socket相关枚举
/// </summary>

namespace GameLogic
{
    public enum D_TYPE
    {
        // 0表示没有类型
        NONE = 0,
        // 数值类型
        [TypeSize(2)] WORD,         // UInt16
        [TypeSize(1)] BOOL8,        // UInt8
        [TypeSize(4)] BOOL,         // UInt32
        [TypeSize(1)] WORD8,        // UInt8
        [TypeSize(1)] BYTE,         // Byte
        [TypeSize(4)] DWORD,        // UInt32
        [TypeSize(2)] SHORT,        // Int16
        [TypeSize(4)] UINT,         // UInt32
        [TypeSize(4)] INT,          // Int32
        [TypeSize(8)] INT64,        // Int64
        [TypeSize(8)] UINT64,       // UInt64

        // 字符串类型
        [TypeSize(10)] TCHAR10,     // String10
        [TypeSize(16)] TCHAR16,     // String16
        [TypeSize(20)] TCHAR20,     // String20
        [TypeSize(24)] TCHAR24,     // String24
        [TypeSize(32)] TCHAR32,     // String32
        [TypeSize(40)] TCHAR40,     // String40
        [TypeSize(64)] TCHAR64,     // String64
        [TypeSize(128)] TCHAR128,   // String128
        [TypeSize(256)] TCHAR256,   // String256

        //常用特定名称类型
        [TypeSize(4)] COLORREF,     // Int32
        [TypeSize(4)] USER_ID_PTR,  // UInt32
        [TypeSize(4)] SERVER_ID_PTR,// UInt32
    }

    public class SocketDefinition
    {
        #region 通用
        public const uint GAME_REF = 0x80000000;

        public const uint BS_MSG_LS2LSIGN = 0x1600;
        public const uint BS_MSG_LOBBY = 0xA00;
        public const uint BS_MSG_MS2LS = 0x1790;
        public const uint BS_MSG_LS2LTS = 0x1858;
        public const uint BS_MSG_MATCHIS = 0x1E00;
        public const uint BS_MSG_TOURNEYIS = BS_MSG_MATCHIS + 0x100;
        public const uint BS_MSG_ONLINE = 0xE00;
        public const uint BS_MSG_MREMIND2LS = 0x37F4;
        public const uint BS_MSG_ACCSG2ONLINE = 0x3790;
        public const uint BS_MSG_SECURITY = 0x3664;
        public const uint BS_MSG_AGENT = 0x1200;
        public const uint BS_MSG_WEBS2LC = 0x2000;
        public const uint BS_MSG_ADD = 0x2E96 + 0x1;
        public const uint BS_MSG_GAME_BASE = 0x7200;
        public const uint BS_MSG_GAME = 0x7600;
        public const uint BS_MSG_DATA = 0x2600;
        public const uint BS_STATISTICS = 0x2E96;
        public const uint BS_MSG_WATCH2CLT = 0x8400;
        public const uint BS_MSG_GS2MIGS = 0x8500;
        public const uint BS_MSG_MGS2ANY = BS_MSG_GS2MIGS + 0x20;
        public const uint BS_MSG_CLT2ANY = BS_MSG_GS2MIGS + 0x40;
        public const uint BS_MSG_ANY2CLT = BS_MSG_GS2MIGS + 0x60;
        public const uint BS_MSG_CPACKET = 0x8100;

        public const int UNSPECIFIED_VALUE = 65535;

        public const int MAX_NAME_LENGTH = 32;
        public const int MAX_CHAT_LENGTH = 256;

        public static int LICENSE_COUNT = 2;
        public static int TRANSFORMER_TOTAL = 2 * LICENSE_COUNT;

        /// <summary>
        /// 默认字符串编码的页码数，使用GBK编码的页码数
        /// </summary>
        public const int DEFAULT_ENCODING_CODEPAGE = 936;
        #endregion

        #region 包头Head默认值
        public const ushort TAG_BS = 0x5342;
        public const uint NEW_HEAD_IDENTIFY = 0x9FFF_FFFF;
        //通用head的int参数,值为0
        public const int HEAD_PARAM_ZERO = 0;

        public enum MESSAGE_VER_TYPE { NO = 0x20 };
        public enum ORIGIN_TYPE { CLTPC = 1100, CLTLUA = 1200, CLTH5 = 1300 };
        #endregion

        #region 消息系统
        public enum MSG_TYPE
        {
            TEXT_MESSAGE = 1,
            LOGIN_IMAGE_MESSAGE = 2,
            FLOAT_MESSAGE = 5,
            NORMAL_IMAGE_MESSAGE = 6
        }
        #endregion

        #region 聊天服务器相关
        public const string SPECIAL_CHAT = "\\=";
        public const string EMOJI_FLAG = "\\=a";
        public const string PROP_FLAG = "\\=t";
        public const string NOTICE_FLAG = "\\=event";
        public enum CHAT_TYPE
        {
            USER = 0,
            BROADCAST,
            SYSTEM,
            ADMIN,
            VOICE,
            ITEM,
            NOTICE,
            REWARD,
            TEAMMATE,
            TASK = 0x10,
            GAME = 0x20
        }
        public enum NEW_SOCKET_CHAT_TYPE
        {
            USER = 1,
            EMOJI = 2,
            ITEM = 3
        }

        public enum CHAT_TARGET_TYPE
        {
            ALL = 0,
            FRIEND = 1,
            ENEMY = 2,
            CHOOSE = 3
        }
        #endregion

        #region 登录相关
        public enum LOGIN_TYPE
        {
            USER_NAME = 0,
            USER_ID = 1,
            MOBILE = 2,
            TICKET_DEPRECATED = 3,
            QQ = 4,
            SINA = 5,
            VISITOR = 6,
            WEIXIN = 7,
            BAIDU = 8,
            QH360 = 9,
            HUAWEI = 10,
            WXPUB = 11,
            OPPO = 12,
            VIVO = 13,
            MI = 14,
            YYB = 15,
            APPLE = 16,
            HONOR = 17,
            HARMONY = 18,
            MSG = 20,
            AUTH = 21,
            PHONE_NUM_AUTH = 22,
            THIRD_AUTH = 23,
            HARMONY_CREATE_ACCOUNT = 24,
            RECONNECT_TICKET = 103,
            TICKET = 203
        }

        /** 登录标识 */
        public enum LOGIN_FLAG
        {
            //个位代表类型
            /** 账密不锁定本机 */
            TYPE_UNBIND = 0x0,
            /** 账密锁定本机 */
            TYPE_LOCAL = 0x1,
            /** 三方登录 */
            TYPE_OPEN_ID = 0x2,
            /** 手机登录 */
            TYPE_PHONE = 0x3,
            /** 用于老pc强更至去外壳大厅的平台，那些账号不知道有没有绑定过，状态就是这个 */
            TYPE_LOCAL_NUKNOW = 0x9,

            //十位代表平台
            /** 桌面*/
            MODE_DESKTOP = 0x0,
            /** 手机*/
            MODE_MOBILE = 0x20,
            TYPE_MASK = 0x70
        }

        /** 锁定（绑定）本机的类型 */
        public enum BIND_MAC_TYPE
        {
            /** 不绑定（锁定）本机 */
            UNBIND = 0,
            /** 绑定（锁定）本机 */
            BIND = 1,
            /** 数值暂时未知，于大厅特殊阶段使用，已弃用*/
            [Obsolete("表示数值暂时未知，于大厅特殊阶段使用，已弃用")]
            UNKNOW = 2
        };

        public enum DEVICE_OS_TYPE {
            Android = 1,
            iOS,
            Windows,
            MacOrLinux,
            Chrome,
            Harmony
        }
        #endregion
        public enum KICK_OUT_TYPE
        {
            /** 被顶号 */
            NORMAL = 11,
            /** 账号被封禁 */
            BAN = 14,
            /** 账号被冻结 */
            BLOCKED = 15,
            /** 未成年人非游戏时间，强制下线 */
            GOTOSTUDY = 16
        }

        /** 登录时，热更模式
         */
        public enum LOGIN_JS_UPDATE_MODE
        {
            /** 无需热更 */
            NO_UPDATE,
            /** 非强制更新 */
            NOT_FORCE_UPDATE,
            /** 强制更新 */
            FORCE_UPDATE
        }

        /** 数值推送类型 */
        public enum DATA_PUSH_C_TYPE
        {
            /** 无 */
            NONE = 0,
            /** 银子（钱） */
            MONEY,
            /** 物品（物） */
            THING,
            /** 养成值、分数（分） */
            SCORE,
            /** 道具 */
            PROP
        }
    }
}